package com.vtech.spring;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;

/**
 * 项目主类
 * <pre/>
 * 若不需要打包为 war 部署到 tomcat，则
 * 1. 去掉 SpringBootServletInitializer 继承
 * 2. 注释掉 configure 方法
 * 3. 项目打包方式改为 jar
 * @author houzhiwei
 * @date 2018/7/22 16:39
 */
@SpringBootApplication
@ServletComponentScan
public class ApplicationServlet extends SpringBootServletInitializer {

    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
        // 注册Spring配置类
        return builder.sources(ApplicationServlet.class);
    }
    public static void main(String[] args) {
        SpringApplication.run(ApplicationServlet.class, args);
    }
}
